package com.jl.jlapp.mvp.fragment;

import android.content.res.Resources;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.SpannableStringBuilder;
import android.text.TextPaint;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import com.jl.jlapp.R;

import butterknife.BindView;
import butterknife.ButterKnife;

public class AddVatInvoiceFragment extends Fragment {
    @BindView(R.id.bankAccount)
    EditText bankAccount;
    @BindView(R.id.btn_next)
    TextView btnNext;
    @BindView(R.id.depositBank)
    EditText depositBank;
    @BindView(R.id.rb_agree)
    CheckBox rbAgree;
    @BindView(R.id.registeredAddress)
    EditText registeredAddress;
    @BindView(R.id.registeredTel)
    EditText registeredTel;
    @BindView(R.id.taxpayerIdentificationNumber)
    EditText taxpayerIdentificationNumber;
    @BindView(R.id.unitName)
    EditText unitName;

    public void handleTips() {
        String str = this.rbAgree.getText().toString().trim();
        SpannableStringBuilder localSpannableStringBuilder = new SpannableStringBuilder(str);
        localSpannableStringBuilder.setSpan(new ClickableSpan() {
            public void onClick(View paramAnonymousView) {
                Toast.makeText(AddVatInvoiceFragment.this.getActivity(), "暂无内容!", Toast.LENGTH_LONG).show();
            }

            public void updateDrawState(TextPaint paramAnonymousTextPaint) {
                super.updateDrawState(paramAnonymousTextPaint);
                paramAnonymousTextPaint.setColor(AddVatInvoiceFragment.this.getResources().getColor(R.color.checkGreenColor));
                paramAnonymousTextPaint.setUnderlineText(false);
                paramAnonymousTextPaint.clearShadowLayer();
            }
        }, str.length() - 9, str.length(), 33);
        this.rbAgree.setText(localSpannableStringBuilder);
        this.rbAgree.setMovementMethod(LinkMovementMethod.getInstance());
    }

    public View onCreateView(LayoutInflater paramLayoutInflater, ViewGroup paramViewGroup, Bundle paramBundle) {
        View view = paramLayoutInflater.inflate(R.layout.fragment_add_vat_invoice, null, false);
        ButterKnife.bind(this, view);
        handleTips();
        this.btnNext.setOnClickListener(new OnClickListener() {
            public void onClick(View paramAnonymousView) {
                String str = AddVatInvoiceFragment.this.unitName.getText().toString().trim();
                String str1 = AddVatInvoiceFragment.this.taxpayerIdentificationNumber.getText().toString().trim();
                String str2 = AddVatInvoiceFragment.this.registeredAddress.getText().toString().toString().trim();
                String str3 = AddVatInvoiceFragment.this.registeredTel.getText().toString().trim();
                String str4 = AddVatInvoiceFragment.this.depositBank.getText().toString().trim();
                String str5 = AddVatInvoiceFragment.this.bankAccount.getText().toString().toString().trim();
                if ("".equals(str)) {
                    Toast.makeText(AddVatInvoiceFragment.this.getActivity(), "请填写单位名称", Toast.LENGTH_SHORT).show();
                }
                do {
                    if ("".equals(str1)) {
                        Toast.makeText(AddVatInvoiceFragment.this.getActivity(), "请填写纳税人识别码", Toast.LENGTH_SHORT).show();
                        return;
                    }
                    if ("".equals(str2)) {
                        Toast.makeText(AddVatInvoiceFragment.this.getActivity(), "请填写注册地址", Toast.LENGTH_SHORT).show();
                        return;
                    }
                    if ("".equals(str3)) {
                        Toast.makeText(AddVatInvoiceFragment.this.getActivity(), "请填写注册电话", Toast.LENGTH_SHORT).show();
                        return;
                    }
                    if ("".equals(str4)) {
                        Toast.makeText(AddVatInvoiceFragment.this.getActivity(), "请填写开户银行", Toast.LENGTH_SHORT).show();
                        return;
                    }
                } while (!"".equals(str5));
                Toast.makeText(AddVatInvoiceFragment.this.getActivity(), "请填写银行账户", Toast.LENGTH_SHORT).show();
            }
        });
        this.rbAgree.setOnCheckedChangeListener(new OnCheckedChangeListener() {
            public void onCheckedChanged(CompoundButton paramAnonymousCompoundButton, boolean paramAnonymousBoolean) {
                if (paramAnonymousBoolean) {
                    AddVatInvoiceFragment.this.btnNext.setClickable(true);
                    AddVatInvoiceFragment.this.btnNext.setTextColor(AddVatInvoiceFragment.this.getResources().getColor(R.color.checkGreenColor));
                    AddVatInvoiceFragment.this.btnNext.setBackgroundResource(R.drawable.btn_green_large);
                    return;
                }
                AddVatInvoiceFragment.this.btnNext.setClickable(false);
                AddVatInvoiceFragment.this.btnNext.setTextColor(AddVatInvoiceFragment.this.getResources().getColor(R.color.font_grey));
                AddVatInvoiceFragment.this.btnNext.setBackgroundResource(R.drawable.btn_gray_large);
            }
        });
        return view;
    }
}


/* Location:              /Users/davidzhang/Documents/decompileApk/jlfood-dex2jar.jar!/com/jl/jlapp/mvp/fragment/AddVatInvoiceFragment.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */